/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package conexao;


import java.sql.SQLException;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;


/**
 *
 * @author aluno
 */
public class ConexaoSingleton {
    
    private static EntityManagerFactory emf = null;
    private static EntityManager manager = null;

    public static EntityManager getConexao()throws SQLException{
        try{
            if(emf == null)
                emf = Persistence.createEntityManagerFactory("PrevisjPU");
                manager = emf.createEntityManager();
                return manager;
        }catch (Exception e){
            e.printStackTrace();
          
        }
        return null;

    }

}
